﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="EmployeeReport.aspx.cs" Inherits="MonkeyWarranty.Web.Reports.InstantTicketReports.EmployeeReport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <title>Tổng hợp công việc theo nhân viên</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3>Tổng hợp công việc theo nhân viên</h3>
    <div class="row">
        <div class="col-lg-12">
            <div class="well">
                <div class="form-inline">
                    Ngày: <input type="text" id="dateFrom" class="form-control" /> - <input type="text" id="dateTo" class="form-control" />
                    <input type="button" class="btn btn-primary" value="Load" id="LoadButton" />
                </div>
            </div>
            
            <div id="ReportTable"></div>
        </div>
    </div>
    
    <div class="row">
        <div class="col-lg-12">
            <p></p>
            <button id="ExportButton" class="btn btn-success">Xuất Excel</button>
        </div>
    </div>

    <script type="text/javascript">
        $(function () {
            $("#menu-report").addClass("active");
            $("#menu1-report").addClass("collapse in");
            $("#report-svc").addClass("active");
            $("#report1-svc").addClass("collapse in");
            $("#report1-svc1").addClass("active");

            $("#dateFrom").calendar({ timeSeparators: null });
            $("#dateTo").calendar({ timeSeparators: null });

            $('#ReportTable').jtable({
                paging: false,
                sorting: false,
                actions: {
                    listAction: 'EmployeeReport.aspx/ReportEmployee'
                },
                fields: {
                    EmployeeId: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    EmployeeName: {
                        title: 'Nhân viên'
                    },
                    NumOfWorks: {
                        title: 'Số lượng công việc'
                    },
                    TotalDistance: { title: 'Khoảng cách (km)' },
                    TotalHoursString: { title: 'Số giờ làm việc' }
                }
            });

            $('#LoadButton').click(function () {
                $('#ReportTable').jtable('load', {
                    dateFrom: $('#dateFrom').val(),
                    dateTo: $('#dateTo').val()
                });
            });

            $('#LoadButton').click();

            $('#ExportButton').click(function (e) {
                e.preventDefault();
                window.location = 'EmployeeReportExport.aspx?' +
                    'dtFrom=' + $('#dateFrom').val() +
                    '&dtTo=' + $('#dateTo').val();
            });
        });
    </script>
</asp:Content>
